# Contributor: Jordi De Groof <jordi dot degroof at gmail dot com>
# Contributor: Andre Klitzing <aklitzing () gmail () com>
# Contributor: Simon Sobisch <simonsobisch () gnu () org>

_realname=lcov
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.14
pkgrel=2
pkgdesc="front-end for GCC's coverage testing tool gcov"
arch=('any')
url="https://ltp.sourceforge.io/coverage/lcov.php"
license=('GPL')
depends=("${MINGW_PACKAGE_PREFIX}-perl" 'perl-JSON' 'perl-PerlIO-gzip')
source=("https://downloads.sourceforge.net/ltp/${_realname}-${pkgver}.tar.gz"
        "001-mingw-lcov1.12-handle-equals-signs.patch"
        "002-mingw-lcov1.12-fix-undef-behaviour.patch"
        "003-geninfo-Add-intermediate-text-format-support.patch"
        "004-geninfo-Add-intermediate-JSON-format-support.patch")
sha256sums=('14995699187440e0ae4da57fe3a64adc0a3c5cf14feab971f8db38fb7d8f071a'
            '54728aa4e244d3662c65ba91fb486dc1d5c64d9d55745ee334c4131109dc233c'
            'ceaf41f7cc9cea5a6fc4b0385ffef10d1ab8812acd2a5b16dcd8d7bca7120488'
            '51141cc186a94dfcd19a5927e40a0b3eb897dcfe8fe57a63ea456cb69ed6ed37'
            '5ba4ecf9e6ad987bd18acbd79f75f0c65b4bbcaeb1f7dab8bcbcbe326054dfeb')
prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
  patch -p1 -i ${srcdir}/001-mingw-lcov1.12-handle-equals-signs.patch
  patch -p1 -i ${srcdir}/002-mingw-lcov1.12-fix-undef-behaviour.patch
  patch -p1 -i ${srcdir}/003-geninfo-Add-intermediate-text-format-support.patch
  patch -p1 -i ${srcdir}/004-geninfo-Add-intermediate-JSON-format-support.patch
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"
  make PREFIX="${pkgdir}/${MINGW_PREFIX}" install
}
